package jjn.acwing.algorithm_basic.chapter1.difference;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 * @author Jiang Jining
 * @since 2023-09-21 22:21
 */
public class Acwing797 {
    
    static void insert(int[] difference, int l, int r, int c) {
        difference[l] += c;
        difference[r + 1] -= c;
    }
    
    public static void main(String[] args) throws IOException {
        BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
        String line = bufferedReader.readLine();
        String[] inputs = line.split(" ");
        int n = Integer.parseInt(inputs[0]);
        int m = Integer.parseInt(inputs[1]);
        String numbers = bufferedReader.readLine();
        int[] nums = new int[n + 1];
        String[] parts = numbers.split(" ");
        for (int i = 1; i <= n; i++) {
            nums[i] = Integer.parseInt(parts[i - 1]);
        }
        int[] difference = new int[n + 1];
        for (int i = 1; i <= n; i++) {
            insert(difference, i, i, nums[i]);
        }
        for (int i = 0; i < m; i++) {
            String readLine = bufferedReader.readLine();
            String[] examples = readLine.split(" ");
            int l = Integer.parseInt(examples[0]);
            int r = Integer.parseInt(examples[1]);
            int c = Integer.parseInt(examples[2]);
            insert(difference, l, r, c);
        }
        for (int i = 1; i <= n; i++) {
            difference[i] += difference[i - 1];
        }
        for (int i = 1; i <= n; i++) {
            System.out.print(difference[i] + " ");
        }
        System.out.println();
    }
}
